1. Technical Field
The present invention generally relates to computer systems. More specifically, the present invention relates to a method and system for resetting memory locks in a transactional memory system.
2. Description of the Related Art
Computer systems that include multiple processors allow multiple concurrent executing threads to access shared memory locations. Writing multi-threaded programs is difficult due to the complexities of coordinating concurrent memory access. One approach to concurrent control between multiple threads of execution is the utilization of transactional memory. In a transactional memory system, a section of code (e.g., an execution path or a set of program instructions) is designated as a transaction. The transaction executes atomically with respect to other threads of execution within the transactional memory system. For example, if the transaction includes two memory write operations, then the transactional memory system ensures that all other threads may only observe either the cumulative effects of both memory operations or of neither, but not the effects of only one.
When transactions heavily contest a region of memory, lock elision using memory locks can be used. A memory lock guarantees that the thread has exclusive access to shared data for a section of code. A thread acquires the lock and executes its critical section. Unfortunately, it is difficult to release the memory lock for highly contested transactions back to transactional memory. Because of the processing overhead associated with measuring contested transactions, it is not possible to measure successful accesses without contested transactions, and as such only contested transactions can be measured. Transactional memory is not very useful in many applications because even transactions that have very occasional contested transactions will revert to taking memory locks over time. The result is that over time a large percentage of transactions will have memory locks that cannot be released.